import pandas as pd


def preprocessing(file_path):
    """
    :param file_path: 文件路径(相对、绝对路径均可)
    :return: 处理后的df对象
    """

    # 1.加载文件夹
    df = pd.read_csv(file_path,encoding="utf-8")

    # 2.日期时间格式化
    df["time"] = pd.to_datetime(df["time"]).dt.strftime("%Y-%m-%d %H:%M:%S")

    # 3.返回df对象
    return df


if __name__ == '__main__':
    df = preprocessing("../data/train.csv")
    print(df.head(5))
